<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>离线分析</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="./css/header.css" rel="stylesheet" type="text/css"/>
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script src="js/highcharts.js"></script>
	<script src="js/exporting.js"></script>
	
	<script type="text/javascript">
  $(function(){  
	          $.ajax({
	        	  type: "POST",
	              dataType: "JSON",
	              url:"servlet/Offline",
	              success: function (data) {
	            	  var chart = new Highcharts.Chart({
	            		  exporting: {
					            buttons: {
					                contextButton: {
					                    menuItems: [
					                    	Highcharts.getOptions().exporting.buttons.contextButton.menuItems[0]
					                    ]
					                    .concat([{
					                        separator: true
					                    },{
					                        text: '导出PNG文件',
					                        onclick:function() {
					                        	exportChart(chart,"image/png");
					                        }
					                    },{
					                        text: '导出JPG文件',
					                        onclick:function() {
					                        	exportChart(chart,"image/jpeg");
					                        }
					                    },{
					                        text: '导出SVG文件',
					                        onclick:function() {
					                        	exportChart(chart,"image/svg+xml");
					                        }
					                    },{
					                        text: '导出PDF文件',
					                        onclick:function() {
					                        	exportChart(chart,"application/pdf");
					                        }
					                    }])
					                }
					            }
					        },
					        chart : {
								renderTo: 'container'
							},
	            	        title: {
	            	            text: '2011年10月份公众情感走势',
	            	            x: -20 //center
	            	        },
	            	        subtitle: {
	            	            text: '(折线图)',
	            	            x: -20
	            	        },
	            	        xAxis: {
	            	            categories: ["1","2","3","4","5","6","7","8","9","10",
	            	                         "11","12","13","14","15","16","17","18","19","20",
	            	                         "21","22","23","24","25","26","27","28","29","30","31"]
	            	                
	            	        },
	            	        yAxis: {
	            	            title: {
	            	                text: '情感值'
	            	            },
	            	            plotLines: [{
	            	                value: 0,
	            	                width: 1,
	            	                color: '#808080'
	            	            }]
	            	        },
	            	       
	            	        series:data,
	            	        credits:{
	            	        	enabled:false
	            	        }
	            	    });
	            	  $(".download").click(function(){
					    	exportChart(chart,$(this).attr("type"));
					    });
	  }
  });
	          function exportChart(chart,type) {
	  			$("input[name='svg']").val(chart.getSVG());
	  			$("input[name='width']").val(600);
	  			$("input[name='type']").val(type);
	  			$("input[name='method']").val("download");
	  			$("form").submit();
	  		}
	  });
 
  </script>
  
  </head>
  
  <body>
  
<div id="header">
        <div class="logdo" style=“weight="150px";float:left;padding-left:10px;”>
			<a href="./index.jsp">
				<img src="./img/logo.png">
			</a>
		</div>
        <div id="nav">
            <ul class="menu">
                <li class="current"><a href="./index.jsp">首页</a></li>
                <li><a href="./spline.jsp">在线分析</a>
                  <ul>
                  <li><a href="./spline.jsp">曲线图</a></li>
                  <li><a href="./pie.jsp">饼状图</a></li>
                  <li><a href="./hourlyline.jsp">时序图</a></li>
                  <li><a href="./weeklycolumn.jsp">周序图</a></li>
                  </ul> 
                  </li>
                <li><a href="./single.jsp">即时分析</a><span class="lines"></span></li>           
                <li><a href="./offline.jsp">离线分析</a><span class="lines"></span></li>
            </ul>
        </div>
</div>

<div id="main" >

   <div id="container" style="weight:1000px;height:520px;margin-top:20px;"></div>
   <!-- 隐藏的表单 -->
	<form method="post" action="servlet/ExportServlet">
		<input type="hidden" name="svg">
		<input type="hidden" name="width">
		<input type="hidden" name="type">
		<input type="hidden" name="method">
	</form> 
</div>
  </body>
</html>
